<template>
  <div id="app">
    <el-menu
      :default-active="activeIndex2"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      v-if="$route.meta.keepAlive"
    >
      <el-submenu index="1">
        <template slot="title">信息中心</template>
        <el-menu-item index="1-1" @click="stuAllInfo">学生信息</el-menu-item>
        <el-menu-item index="1-2" @click="teaAllInfo">教师信息</el-menu-item>
        <el-menu-item index="1-3" @click="compAllInfo">企业信息</el-menu-item>
        <el-menu-item index="1-4" @click="datadriver">数据展示</el-menu-item>
      </el-submenu>
      <el-submenu index="2">
        <template slot="title">工作中心</template>
        <el-menu-item index="2-1" @click="createUser">新建系统用户</el-menu-item>
        <el-menu-item index="2-2"  @click="portalInfoRelease">门户新闻发布</el-menu-item>
        <el-menu-item index="2-3"  @click="myPortalInfoRelease">新闻发布管理</el-menu-item>
        <el-menu-item index="2-5">就业信息发布</el-menu-item>
        <el-menu-item index="2-4" >生成企业坐标</el-menu-item>
      </el-submenu>
      <el-submenu index="3">
        <template slot="title">消息中心</template>
        <el-menu-item index="3-1">基础信息</el-menu-item>
        <el-menu-item index="3-2">信息发布</el-menu-item>
        <el-menu-item index="3-3">就业信息</el-menu-item>
      </el-submenu>
      <el-submenu index="5">
        <template slot="title">个人中心</template>
        <el-menu-item index="5-4" @click="updatepwd">修改密码</el-menu-item>
        <el-menu-item index="5-4">注销账号</el-menu-item>
        <el-menu-item index="5-6" @click="loginout">退出登录</el-menu-item>
      </el-submenu>
    </el-menu>
    <router-view></router-view>
  </div>
</template>
<script>
export default {
  name: 'App',
  data() {
    return {
      activeIndex: '1',
      activeIndex2: '1'
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    loginout:function () {
      this.$axios({
        url: `/api/user/manaloginout/`,
        method: 'get',
      }).then(loginOut => {  // 请求成功
        console.log('请求成功');
        console.log(loginOut.data);
        window.location.href = "/#/login";
      }).catch(error => {  // 请求失败
        console.log('请求失败');
        console.log(error);
      });
    },
    updatepwd:function () {
      window.location.href = "/#/updatepwd";
    },
    stuAllInfo:function () {
      window.location.href = "/#/index";
    },
    teaAllInfo:function () {
      window.location.href = "/#/teaAllInfo";
    },
    compAllInfo:function () {
      window.location.href = "/#/compAllInfo";
    },
    datadriver:function () {
      window.location.href = "/#/datadriver";
    },
    portalInfoRelease:function () {
      window.location.href = "/#/portalInfoRelease";
    },

    myPortalInfoRelease:function () {
      window.location.href = "/#/myPortalInfoRelease";
    },
    createUser:function () {
      window.location.href = "/#/createUser";
    }

  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
